FROM openjdk:8-jdk-alpine

MAINTAINER FuFei

WORKDIR /runtime

COPY app-demo-boot-*.jar app.jar

ENV ACTIVE=""
ENV JVM_OPT="-XX:+PrintCommandLineFlags -XX:+UseContainerSupport -XX:MaxRAMPercentage=80.0 -XX:MinRAMPercentage=80.0 -XX:InitialRAMPercentage=80.0 -XX:+HeapDumpOnOutOfMemoryError"
# -Duser.country=CN -Duser.language=zh -Duser.timezone=Asia/Shanghai
ENV JVM_OPT_EXT=""
ENV TZ=Asia/Shanghai
ENV LANG=zh_CN.UTF-8
ENV LANGUAGE=zh_CN:zh
ENV LC_ALL=zh_CN.UTF-8

RUN echo "https://mirrors.aliyun.com/alpine/v3.8/main/" > /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/v3.8/community/" >> /etc/apk/repositories
RUN apk update
RUN apk add --no-cache tzdata openssl wget ca-certificates ttf-dejavu fontconfig fontconfig-lang-zh
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "zh_CN.UTF-8 UTF-8" > /etc/locale.gen && locale-gen

ENTRYPOINT ["/bin/sh", "-c", "java -Dspring.profiles.active=${ACTIVE} ${JVM_OPT} ${JVM_OPT_EXT} -jar /runtime/app.jar"]